<template>
	<view class="container">

		<view class="desc"><text style="font-size: 20px;color: #007AFF;">zkx</text>小程序想要获取您的昵称和头像,是否允许</view>

		<button @click="getUserInfo()" style="width: 375rpx;background: #18BC37;color: #fff;">点击获取权限</button>

	</view>
</template>

<script>
	import {
		appQuery,
		aQuery
	} from '../../api/home.js'
	export default {
		data() {
			return {
				nickName:'',
				avatarUrl:''
			}
		},
		methods: {
			getUserInfo() {
				let that = this
				uni.getUserProfile({
					desc: "weixin", // 指明用途,这个参数是必须的
					success: function(res) {
						console.log(res)
						// that.nickName = res.userInfo.nickName
						// that.avatarUrl = res.userInfo.avatarUrl
						console.log(res.userInfo)
						uni.navigateTo({
							url:'/pages/map/map'
						})
					}
				})
			}
		},
		onLoad() {
			// 测试封装请求
			// appQuery({
			// 	a: 1
			// }).then(res => {
			// 	console.log(res);
			// })
			// aQuery({
			// 	a: 1
			// }).then(res => {
			// 	console.log(res);
			// })
		}
	}
</script>

<style>
	.container{
		padding-top: 50px;
	}
	.desc {
		margin-bottom: 30px;
		text-align: center;
	}
</style>
